package offerv1;

public class Offer50 {
    public char firstUniqChar(String s) {
        int[] dict = new int[26];
        int n = s.length();
        for (int i = 0; i < n; i++) {
            dict[s.charAt(i) - 'a']++;
        }

        for (int i = 0; i < n; i++) {
            char c = s.charAt(i);
            if (dict[c - 'a'] == 1) {
                return c;
            }
        }

        return ' ';
    }
}
